<template>
  <div class="resume-templates-page">
    <GetBioJobNavbar />
    
    <div class="templates-container">
      <!-- Header -->
      <div class="page-header">
        <h1 class="page-title">Real Biopharma Resume Templates</h1>
        <p class="page-description">
          Access ready-to-use Biopharma Resume Templates — covering R&D, QA/QC, Regulatory, Marketing and more. Customize, save, and export in minutes.
        </p>
        <div class="header-actions">
          <el-select v-model="selectedRole" placeholder="All Roles" style="width: 200px;">
            <el-option label="All Roles" value="all"></el-option>
            <el-option label="R&D" value="rd"></el-option>
            <el-option label="QA/QC" value="qa"></el-option>
            <el-option label="Regulatory" value="regulatory"></el-option>
            <el-option label="Marketing" value="marketing"></el-option>
          </el-select>
          <div class="view-toggle">
            <i class="el-icon-menu" :class="{ active: viewMode === 'grid' }" @click="viewMode = 'grid'"></i>
            <i class="el-icon-s-order" :class="{ active: viewMode === 'list' }" @click="viewMode = 'list'"></i>
          </div>
        </div>
      </div>

      <!-- Templates by Category -->
      <div v-for="category in templateCategories" :key="category.name" class="template-category">
        <h2 class="category-title">{{ category.name }}</h2>
        <div class="templates-grid" :class="{ 'list-view': viewMode === 'list' }">
          <div
            v-for="template in category.templates"
            :key="template.id"
            class="template-card"
            @click="useTemplate(template.id)"
          >
            <div class="template-preview" :class="{ 'premium': template.premium }">
              <div v-if="template.premium" class="premium-badge">GetBioJob Premium Only</div>
              <div class="template-placeholder">{{ template.previewText }}</div>
            </div>
            <div class="template-info">
              <h3 class="template-name">{{ template.name }}</h3>
              <p class="template-description">{{ template.description }}</p>
              <div class="template-actions">
                <el-button type="primary" size="small">Use Template</el-button>
                <el-button size="small" plain>xx Design Style</el-button>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>

    <GetBioJobFooter />
  </div>
</template>

<script>
export default {
  name: 'ResumeTemplatesPage',
  data() {
    return {
      selectedRole: 'all',
      viewMode: 'grid',
      templateCategories: [
        {
          name: 'R&D',
          templates: [
            {
              id: 1,
              name: 'R&D Research',
              description: 'Perfect for research scientists and lab professionals.',
              previewText: 'R&D Research Resume',
              premium: false
            },
            {
              id: 2,
              name: 'R&D Research',
              description: 'Perfect for research scientists and lab professionals.',
              previewText: 'R&D Research Resume',
              premium: true
            }
          ]
        },
        {
          name: 'Marketing',
          templates: [
            {
              id: 3,
              name: 'R&D Research',
              description: 'Perfect for research scientists and lab professionals.',
              previewText: 'R&D Research Resume',
              premium: false
            },
            {
              id: 4,
              name: 'R&D Research',
              description: 'Perfect for research scientists and lab professionals.',
              previewText: 'R&D Research Resume',
              premium: true
            }
          ]
        },
        {
          name: 'Regulatory',
          templates: [
            {
              id: 5,
              name: 'Regulatory Affairs',
              description: 'Tailored for regulatory compliance professionals.',
              previewText: 'Regulatory Affairs Resume',
              premium: false
            }
          ]
        }
      ]
    }
  },
  methods: {
    useTemplate(templateId) {
      this.$message.info('Template editor will open soon')
      // Navigate to template editor
      // this.$router.push(`/resume-editor/${templateId}`)
    }
  }
}
</script>

<style scoped>
.resume-templates-page {
  min-height: 100vh;
  background-color: #fff;
}

.templates-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 24px;
}

.page-header {
  margin-bottom: 48px;
}

.page-title {
  font-size: 36px;
  font-weight: bold;
  color: #000;
  margin-bottom: 16px;
}

.page-description {
  font-size: 16px;
  color: #666;
  margin-bottom: 24px;
  max-width: 800px;
}

.header-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.view-toggle {
  display: flex;
  gap: 8px;
}

.view-toggle i {
  font-size: 20px;
  color: #ccc;
  cursor: pointer;
  padding: 8px;
  border-radius: 4px;
  transition: all 0.3s;
}

.view-toggle i.active {
  color: #000;
  background-color: #f5f5f5;
}

.template-category {
  margin-bottom: 64px;
}

.category-title {
  font-size: 28px;
  font-weight: bold;
  color: #000;
  margin-bottom: 32px;
}

.templates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}

.templates-grid.list-view {
  grid-template-columns: 1fr;
}

.template-card {
  background-color: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition: transform 0.3s, box-shadow 0.3s;
}

.template-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.template-preview {
  height: 200px;
  background-color: #e5e5e5;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.template-preview.premium {
  background-color: #f5f5f5;
}

.premium-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background-color: #ff6b35;
  color: #fff;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: bold;
  z-index: 10;
}

.template-placeholder {
  color: #999;
  font-size: 14px;
  text-align: center;
}

.template-info {
  padding: 20px;
}

.template-name {
  font-size: 18px;
  font-weight: bold;
  color: #000;
  margin-bottom: 8px;
}

.template-description {
  font-size: 14px;
  color: #666;
  margin-bottom: 16px;
  line-height: 1.6;
}

.template-actions {
  display: flex;
  gap: 8px;
}

.template-actions .el-button {
  flex: 1;
}

@media screen and (max-width: 768px) {
  .page-title {
    font-size: 28px;
  }
  
  .header-actions {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
  
  .templates-grid {
    grid-template-columns: 1fr;
  }
}
</style>

